package nexus.foros;

import control.UserBean;
import java.util.ArrayList;
import javax.faces.context.FacesContext;
import javax.faces.el.VariableResolver;

public class MostrarForos {
    private ArrayList<Foro> foros;
    private String codigoEspacio;
    public MostrarForos(){
        codigoEspacio=getUsuario().getCodigoCurso();
        foros=GestorForosDB.getInstance().listarForosUsuario(getUsuario().getId(),getUsuario().getCodigoCurso());
    }
    public ArrayList<Foro> getForos(){
        return foros;
    }
    public Integer getNroFilas(){return 10;}
    public UserBean getUsuario(){
        FacesContext facesContext = FacesContext.getCurrentInstance();
        VariableResolver vr = facesContext.getApplication().getVariableResolver();
        UserBean user = (UserBean)vr.resolveVariable(facesContext, "userBean");
        return user;
    }
}
